﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using FasGUI;
using System.Threading;

namespace FAS
{
    public partial class Form1 : Form
    {
        String objetivo = "1122";
        int materia =8;
        public Form1()
        {
            InitializeComponent();
            Clipboard.Clear();
            GetClipBoardText();
            //MouseClick();
        }

        [System.Runtime.InteropServices.DllImport("user32.dll")]
        public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);

        public const int MOUSEEVENTF_LEFTDOWN = 0x02;
        public const int MOUSEEVENTF_LEFTUP = 0x04;
        public const int MOUSEEVENTF_RIGHTDOWN = 0x08;
        public const int MOUSEEVENTF_RIGHTUP = 0x10;

        public new void MouseClick()
        {
            int x = 100;
            int y = 100;
            mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
            mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
        }

        public void GetClipBoardText()
        {
            bool b = true;
            while (b)
            {
                if (Clipboard.GetText() != null && Clipboard.GetText() != "")
                {
                    richTextBox1.Rtf = Clipboard.GetData(DataFormats.Rtf).ToString();
                    Clipboard.Clear();
                    b = false;
                    button1_Click(null,null);
                }
            }
        }
    
        private void button1_Click(object sender, EventArgs e)
        {
            new NuevoProblemaRTF(this,richTextBox1.Rtf,objetivo,materia);
        }

        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {
            
        }


        public ParameterizedThreadStart a { get; set; }
    }
}
